package com.myq.note.controller;

import com.myq.note.po.Book;
import com.myq.note.po.Result;
import com.myq.note.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/book")
public class BookController {

    @Autowired
    public BookService bookService;

    @GetMapping("/findByName.action")
    public Result findByName(String user_id){
        //System.out.println(user_id);
        Result<List<Book>> result = bookService.findById(user_id);
        return result;
    }



    @GetMapping("/createBook.action")
    public Result createBook(Book book){
        //System.out.println(book);
        Result<Book> result = bookService.createBook(book);
        return result;
    }

}
